--
-- Author: shunguo.chen
-- Date: 2019-07-24 10:26:17
--
-- PvpChallengeMatchView 挑战赛匹配界面
--

local LastChampionPanel = import(".LastChampionPanel")
local TeamTargetPanel = require("app.team.views.TeamTargetPanel")

local fileName = string.getModeName(...)
local ClassRef = class(fileName, app.mvc.ViewBase)

ClassRef.VIEW_ROOT_RES = Res.PvpChallengeMatchScene

function ClassRef:init()
    self._ui.Button_close:addClickEventListener(function()
        executeFunc(self._onCloseView, self)
    end)

    self._ui.Panel_luck:setVisible(false)
    
    self._championPanel = LastChampionPanel.create(self._ui.left)
    self._targetPanel = TeamTargetPanel.create(self._ui.seek)
end

function ClassRef:onOperate(cb)
    self.super.onOperate(self, cb)

    self._championPanel:onOperate(cb)
    self._targetPanel:onOperate(cb)
end

-- info = PvpChallengeSeasonInfo
function ClassRef:refreshChallengeInfo(info)
    self._championPanel:refreshChallengeInfo(info)
end

function ClassRef:getTargetPanel()
    return self._targetPanel
end

function ClassRef:refreshTarget(target)
    self._targetPanel:setData(target)
end

function ClassRef:updateAutoApplyStatus()
    self._targetPanel:updateAutoApplyStatus()
end

function ClassRef:updateAutoRecruitStatus()
    self._targetPanel:updateAutoRecruitStatus()
end

function ClassRef:refreshApplyNew(b)
    self._targetPanel:refreshApplyNew(b)
end

-- team TeamVo
function ClassRef:refreshTeam(team)
    self._targetPanel:refreshTeam(team)
end

function ClassRef:refreshMember()
   self._targetPanel:refreshMember()
end

function ClassRef:refreshTeamList(teamList)
    self._targetPanel:refreshTeamList(teamList)
end

-- 刷新推荐队伍的申请状态
function ClassRef:refreshTeamListApply(team)
    self._targetPanel:refreshTeamListApply(team)
end

function ClassRef:remove()
    self._targetPanel:remove()
end

return ClassRef
